import 'package:flutter/material.dart';
import 'package:flutter_youren/pages/AppContants.dart';

class DrawerListItem extends StatelessWidget {
  final String title;
  final IconData icons;
  final int index;

  const DrawerListItem({super.key, required this.icons, required this.title,required this.index});

  void _jumpPage(BuildContext context) {
    print("ITEM click1 title  $title");
    print("ITEM index pushNamed  $index");
    // Navigator.pushNamed(context, title);
    switch (index) {
      case 0:
        Navigator.pushNamed(context, VIDEO_PAGE);
        break;
      case 1:
        Navigator.pushNamed(context, IMAGE_PAGE);
        break;
      case 2:
        Navigator.pushNamed(context, MUSIC_PAGE);
        break;
      case 3:
        Navigator.pushNamed(context, SHARED_PAGE);
        break;
      case 4:
        Navigator.pushNamed(context, SETTING_PAGE);
        break;
      default:
    }
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        _jumpPage(context);
      },
      child: Row(children: [
        Container(
          padding: const EdgeInsetsDirectional.only(
            start: 15,
          ),
          child: Icon(icons),
        ),
        Container(
          padding: const EdgeInsetsDirectional.only(
            start: 10,
          ),
          height: 60,
          alignment: Alignment.centerLeft,
          child: Text(title),
        ),
      ]),
    );
  }
}
